import { IPSAppEditorStyleRef } from './ipsapp-editor-style-ref';
import { IPSSysPFPlugin } from '../../res/ipssys-pfplugin';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSAppEditorStyleRefImpl extends PSModelObjectImpl implements IPSAppEditorStyleRef {
  get codeName(): string {
    return this.M.codeName;
  }

  get containerType(): string {
    return this.M.containerType;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get editorType(): string {
    return this.M.editorType;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  get orderValue(): number {
    return this.M.orderValue != null ? this.M.orderValue : 99999;
  }

  protected pssyspfplugin: IPSSysPFPlugin | null = null;

  getPSSysPFPlugin(): IPSSysPFPlugin | null {
    if (this.pssyspfplugin != null) return this.pssyspfplugin;
    const value = this.M.getPSSysPFPlugin;
    if (value == null) {
      return null;
    }
    this.pssyspfplugin = this.getPSModel4('res.IPSSysPFPlugin', value, 'getPSSysPFPlugin') as IPSSysPFPlugin;
    return this.pssyspfplugin;
  }

  get psSysPFPlugin(): IPSSysPFPlugin | null {
    return this.getPSSysPFPlugin();
  }

  getPSSysPFPluginMust(): IPSSysPFPlugin {
    const value = this.getPSSysPFPlugin();
    if (value == null) {
      throw new Error('未指定前端模板插件');
    }
    return value;
  }

  get pluginCode(): string {
    return this.M.pluginCode;
  }

  get refTag(): string {
    return this.M.refTag;
  }

  get styleCode(): string {
    return this.M.styleCode;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get extendStyleOnly(): boolean {
    return this.M.extendStyleOnly != null ? this.M.extendStyleOnly : false;
  }

  get cls(): string {
    return 'PSAppEditorStyleRefImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'IPSModelSortable' || cls == 'app.res.IPSAppEditorStyleRef') return true;
    return super.instanceof(cls);
  }
}
